package com.shiliu.api.configuration;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: Mybatis-Plus配置类
 * @author: shiliu
 * @created: 2019/12/18 10:31
 * @version: v1.0.0
 */
@Configuration
public class MybatisPlusConfiguration {

    private final String MYSQL = "mysql";

    /**
     * 配置分页拦截器
     */
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor interceptor = new PaginationInterceptor();
        interceptor.setDialectType(MYSQL);
        return interceptor;
    }

    /**
     * 配置Mybatis-Plus性能分析插件 【生产环境可以关闭】
     */
    @Bean
    public PerformanceInterceptor performanceInterceptor(){
        PerformanceInterceptor interceptor = new PerformanceInterceptor();

        return interceptor;
    }
}
